﻿using SmartSapce.ServiceLocation;
using SmartSpace.Core;
using SmartSpace.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.WebApp
{
    public partial class _launcher : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid applicationId = new Guid(Request.QueryString["id"]);
            if (SsSite.Current != null && SsSite.Current.DefaultPageId != null)
            {
                ICoreService service = ServiceLocator.Get<ICoreService>();
                SmartSpace.Core.Page page = service.GetPage(SsSite.Current.Id, SsSite.Current.DefaultPageId.Value);
                if (page != null)
                {
                    Response.Redirect(page.Url);
                }
                else
                {
                    Logger.Error("WebApp", string.Format("没有发现站点[{1}]的页面[{1}]对象", SsSite.Current.Id, SsSite.Current.DefaultPageId.Value));
                }
            }
            else
            {
                Response.Write("<b>没有设置默认页面</b>");
            }
            //Response.Redirect(string.Format("./_shell.aspx?__id={0}", applicationId));
        }
    }
}